package com.example.qxfw.dysjrh.controller;


import cn.hutool.core.util.ObjectUtil;
import com.example.qxfw.common.SysResult;
import com.example.qxfw.dysjrh.dto.*;
import com.example.qxfw.dysjrh.entity.Msgmediumsmallscale;
import com.example.qxfw.dysjrh.service.IMsgmediumsmallscaleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 *
 * @author
 * @since 2024-12-11
 */
@RestController
@RequestMapping("/automaticStation")
@RequiredArgsConstructor
public class MsgmediumsmallscaleController {

    private final IMsgmediumsmallscaleService service;

    /**
     * 降水量
     * @param dto
     * @return
     */
    @PostMapping("/getAutomaticStationData")
    public SysResult getAutomaticStationData(@RequestBody precipitationDto dto){
        return service.getaaa(dto);
    }


    /**
     * 降水量2查询
     */
    @PostMapping("/getRainData")
    public SysResult getRainData(@RequestBody RainDto rainDto){
        return SysResult.success(service.getRainData(rainDto));
    }


    /**
     * 气温查询
     * @param funType
     * @return
     */
    @GetMapping("/getAutomaticDrybulbtempData")
    public SysResult getAutomaticDrybulbtempData(@RequestParam("funType") String funType){
        return service.getAutomaticDrybulbtempData(funType);
    }


    /**
     * 气温2
     * 查询时间段内最高温、最低温、平均温度
     */
    @PostMapping("/getDrybulbtemp")
    public SysResult getDrybulbtemp(@RequestBody DrybulbtempDto drybulbtempDto){
        return SysResult.success(service.getDrybulbtemp(drybulbtempDto));
    }


    /**
     * 最小能见度
     */
    @PostMapping("/getMinVisibility")
    public SysResult getMinVisibility(@RequestBody VisibilityDto visibilityDto){
        return  SysResult.success(service.getMinVisibility(visibilityDto));
    }



    /**
     * 相对湿度
     */
    @PostMapping("/getRelhumidity")
    public SysResult getRelhumidity(@RequestBody RelhumidityDto relhumidityDto){
        return SysResult.success(service.getgetRelhumidity(relhumidityDto));
    }

    /**
     * 气压查询
     */
    @PostMapping("/getPressureData")
    public SysResult getPressureData(@RequestBody PressDto pressDto){
        return SysResult.success(service.getPressureData(pressDto));
    }



    /**
     * 风速查询：
     */
    @PostMapping("/getWindVelocity")
    public SysResult getWindVelocity(@RequestBody WindVelocityDto windVelocityDto){
        return SysResult.success(service.getWindVelocity(windVelocityDto));
    }










//    @GetMapping("/getAutomaticStationData")
//    public SysResult getAutomaticStationData(@RequestBody Msgmediumsmallscale msgmediumsmallscale){
//        Page page = new Page(1, 2);
//        Page<Msgmediumsmallscale> page1 =
//                service.lambdaQuery()
//                        .eq(ObjectUtil.isNotEmpty(msgmediumsmallscale.getDrybulbtemp()), Msgmediumsmallscale::getDrybulbtemp, msgmediumsmallscale.getDrybulbtemp()) //湿度
//                        .eq(ObjectUtil.isNotEmpty(msgmediumsmallscale.getWindvelocity()),Msgmediumsmallscale::getWindvelocity,msgmediumsmallscale.getWindvelocity()) //风速
//                        .eq(ObjectUtil.isNotEmpty(msgmediumsmallscale.getVisibility()),Msgmediumsmallscale::getVisibility,msgmediumsmallscale.getVisibility()) //能见度
//                        .page(page);
//        return SysResult.success(page1);
//    }

}
